package servlet.controller;

import entity.Student;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * User: key
 * ClassName:GetAllController
 * Date: 2023/5/5
 * Time: 9:59
 * description:
 */
@WebServlet("/getAll")
public class GetAllController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<Student> stuList = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            stuList.add(new Student("张"+i,"男"));
        }
        req.setAttribute("list",stuList);
        req.getRequestDispatcher("index.jsp").forward(req,resp);
    }
}
